<template>
    <div class="my-button" :style="style">
        <span>
            <slot>点击</slot>
        </span>
    </div>
</template>

<script>
export default {
    name: 'MyButton',
    props: {
        width: {
            type: [Number, String],
            default: '10vw'
        },
        height: {
            type: [Number, String],
            default: '5vw'
        },
        backgroundColor: {
            type: String,
            default:'#E83A3A'
        }
    },
    data() {
        function addPx(val) {
            return typeof val === 'number'? val + 'px': val
        }

        return {
            style: {
                width: addPx(this.width),
                height: addPx(this.height),
                backgroundColor: this.backgroundColor
            }
        }
    },
}
</script>

<style lang="scss" scoped>
.my-button{
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    font-size: 34px;
}
</style>